package day06;

import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;

public class MethodDemo {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        /*say();


        System.out.println("继续执行...");
        System.out.println("-------------------");
        sayHi("abc");
        sayHello("aaa",22);
        sayHello("bbb",80);

         */

        /*System.out.println("请输入相加的两个数：");
        int a=scan.nextInt(),b=scan.nextInt();

        int sum=sum(a,b);
        System.out.println("和是："+sum);
         */

        /*int[] arr1=generateArray(5,50);
        System.out.println("第一个元素是："+arr1[0]);

        int[] arr2=generateArray(10,100);
        Arrays.sort(arr2);
        System.out.println("升序：");
        for (int i=0;i<arr2.length;i++){
            System.out.println(arr2[i]);
        }
         */
        say();

        say("gjl");
        say("gjl",22);



    }
    //无参无返回值
    public static void say(){
        System.out.println("大家好");
    }
    //有参无返回值
    public static void say(String name){
        System.out.println("大家好，我叫"+name);
    }

    public static void say(String name,int age){
        if (age>60){
            return;
        }
        System.out.println("大家好，我叫"+name+",今年"+age+"岁了");
    }

    public static void say(int age){}
    public static void say(int age,String name){}

    public static int sum(int num1,int num2){
        int num = num1+num2;
        return num;
    }

    public static int[] generateArray(int len,int max){
        Random rand = new Random();
        int[] arr=new int[len];
        for (int i=0;i<arr.length;i++){
            arr[i]=rand.nextInt(max);

        }
        return arr;
    }


}
